﻿using System;
using System.Collections.Generic;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Text;
using System.Xml;

public partial class cn_UserControl_bottom_ad : System.Web.UI.UserControl
{
    // Fields
    protected string xmlPagePath = "/cn/xml/page.xml";
    string strFormat = "<div class=\"container marginbottom\">"
                        + "<a href=\"{0}\">"
                        + "<img src=\"{1}\" alt=\"{2}\" />"
                        + "</a></div>";


    // Methods
    protected StringBuilder bottomAdBind()
    {
        StringBuilder builder = new StringBuilder();
        try
        {
            XmlDocument document = new XmlDocument();
            document.Load(this.Page.Server.MapPath(this.xmlPagePath));
            XmlElement element = (XmlElement)document.SelectSingleNode("page_ad/bottom");
            builder.AppendFormat(strFormat
                                 , element.GetAttribute("url")
                                 , element.GetAttribute("src")
                                 , element.GetAttribute("alt")
                                 );
        }
        catch
        {
        }
        return builder;
    }

    protected void Page_Load(object sender, EventArgs e)
    {
    }

}